import FormDefinitionHelper from '@/components/form/FromDesigner/FormDefinitionHelper';

export default class {
  appMenu;
  formDefinition;
  formMenu;

  constructor(appMenu, formDefinition, formMenu) {
    this.appMenu = appMenu;
    this.formDefinition = formDefinition;
    this.formMenu = formMenu;
  }

  parseListFields() {
    let helper = new FormDefinitionHelper({...this.formDefinition, fields: this.formDefinition.formFields});
    return helper.findFieldsByNames(this.formMenu.listField);
  }

  parseSearchFields() {
    let helper = new FormDefinitionHelper({...this.formDefinition, fields: this.formDefinition.formFields});
    return helper.findFieldsByNames(this.formMenu.searchFields);
  }
}
